package com.itheima.demo;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

/**
 * @param
 * @return
 */
public class JDBCDemo {
    public static void main(String[] args) {
     /*   //创建JDBCTemplate对象
        DataSource dataSource = new DruidDataSource();
        JdbcTemplate jt = new JdbcTemplate(dataSource);*/
        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("spring.xml");
        JdbcTemplate jt = ac.getBean("jdbcTemplate", JdbcTemplate.class);
        Integer conut = jt.queryForObject("select count(*) from Person", Integer.class);
        System.out.println("conut = " + conut);

    }
}
